All Questions
11 questions
0votes
5answers
1kviews
How to ignore all text containing special character more than once?
Sample Input: apple_ig rabbit_cat_ig dog_ig bird_duck_ig orange_ig goat_ig Expected output: apple_ig dog_ig orange_ig goat_ig I need to ignore all data that contains underscore _ more than once in ...
0votes
3answers
4kviews
How to compare string to a wild card string in shell script?
I want to compare file name string with file mask in a ksh shell script. Can you please correct the syntax? if [ "NPER20200422TEST.PTN" = "NPER*.PTN" ] then echo "File ...
2votes
1answer
1kviews
Align columns evenly without "column - t"
I have an output file created from a Korn shell script. I need to align the output with spaces evenly. Unfortunately column -t is not available on AIX. Actual File: X1vir1000 x1-DFB127 ...
0votes
1answer
289views
Prepare update command using sed
I have a output file that contains 3 different column data- ['AARF'],SAMPLE12,2016-01-05 12:00:00-0500 ,529OFFST,2015-04-16 08:04:21-0400 "['EPROSP_IWS', '...
1vote
3answers
3kviews
sed substitution
I have a string as follows: /test/test/ 12 /test/test My goal is to turn it into: /test/est/ 12 /test/test This is the command: echo "$x" | sed 's@\(/*/\).@\1@g'" I am using at the moment but it is ...
1vote
2answers
4kviews
How to cut every line from a particular string?
input.txt: john_Apple01_xyz_1 john_Fruit_Apple01_abc_c1 john_Apple21_trs_1 john_Fruit_Apple21_efg_1 john_Fruit_Apple21_tefg_1 Desired output: Apple01_xyz_1 Apple01_abc_c1 Apple21_trs_1 Apple21_efg_1 ...
2votes
5answers
3kviews
Regular Expression for Mixed cased words
I want a regular expression that will help me identify if a certain pattern is present as a mixed case in a sentence or not. Say: Fox juMPed the rock Now, I want to find that if the pattern jumped ...
176votes
11answers
483kviews
Delete First line of a file
How can I delete the first line of a file and keep the changes? I tried this but it erases the whole content of the file. $sed 1d file.txt > file.txt
1vote
3answers
2kviews
linux/solaris + verify duplicate valid IP address from file
what the best way to find duplicate IP from file ( I have ksh script in this script I need to write function that check for duplicate IP ) for example if IP - 192.1926.23.52 exists twice in file - ...
1vote
1answer
939views
Linux + replace STRING/WORD in file according to rule
My target is to replace any word/string/Any characters in file with new word/string according to the following rules: If numeric characters on the left side of word/string then we not replace the ...
48votes
4answers
29kviews
Using sed to color the output from a command on solaris
I have a ksh script that must work on both linux and solaris. I'm trying to color the output of specific commands. It works on linux (specifically RHEL6), but not on solaris (SunOS 5.10). Command ...